package com.xs.designpattern;

import lombok.extern.slf4j.Slf4j;

import java.util.Stack;

/**
 * @author xs
 */
@Slf4j
public class Main {
    public static void main(String[] args) {
        Stack<StarMemento> states = new Stack<>();

        Star star = new Star(StarType.SUN, 10000000, 500000);
        log.info(star.toString());
        states.add(star.getMemento());
        star.timePasses();
        log.info(star.toString());
        states.add(star.getMemento());
        star.timePasses();
        log.info(star.toString());
        states.add(star.getMemento());
        star.timePasses();
        log.info(star.toString());
        states.add(star.getMemento());
        star.timePasses();
        log.info(star.toString());
        states.add(star.getMemento());
        log.info("遍历Stack集合->....");
        while (!states.isEmpty()) {
            star.setMemento(states.pop());
            log.info(star.toString());
        }

    }
}